import httpRequest from '@/utils/request'

const prefix = "/admin/user";

// 登录方法
export function login(userName, password, code, uuid) {
	const data = {
		userName,
		password,
		code,
		uuid
	}
	return httpRequest.request({
		url: prefix + '/v1/login',
		headers: {
			isToken: false
		},
		method: 'post',
		data: data,
		})
}

// 注册方法
export function register(userName, password, email) {
	const data = {
		userName,
		password,
		email
		// code
	}
	return httpRequest.request({
		url:  '/admin/user/v1/register',
		headers: {
			isToken: false
		},
		method: 'post',
		data: data,
	})
}
// 退出方法
// export function logout() {
// 	return httpRequest.request({
// 		url: prefix + '/v1/logout',
// 		method: 'post'
// 	})
// }
export function logout() {
	return httpRequest.request({
		url: `/admin/user/v1/logout`,
		method: 'delete',
	});
}
// 获取验证码
export function getCodeImg() {
	return httpRequest.request({
		url: prefix + '/captchaImage',
		headers: {
			isToken: false
		},
		method: 'get',
		timeout: 20000
	})
}